package com.sugon.modules.analyse.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * 柱状图OPTION
 *
 * @version V1.0
 * @author: yuxd
 * @date: 2021-03-25 11:51
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BarChartOptionModel<T> implements Serializable {

    private static final long serialVersionUID = -1124202139669026404L;

    /**
     * 图例标记列表
     */
    private List<String> legendData;

    /**
     * 横坐标内容列表
     */
    private Collection<String> xAxisData;

    /**
     * 纵坐标Option项数据模型
     */
    private BarChartYAxisOptionModel barChartYAxisOptionModel;

    /**
     * 柱状图序列
     */
    private ArrayList<BarChartSeriesModel<T>> barSeriesData;

    public BarChartOptionModel() {
        this.legendData = new ArrayList<>();
        this.xAxisData = new ArrayList<>();
        this.barChartYAxisOptionModel = new BarChartYAxisOptionModel();
        this.barSeriesData = new ArrayList<>();
    }

    public BarChartOptionModel(ArrayList<String> xAxisData) {
        this();
        this.barChartYAxisOptionModel = new BarChartYAxisOptionModel();
        this.xAxisData = xAxisData;
    }

    public void addBarSeriesData(BarChartSeriesModel<T> barChartSeriesModel) {
        this.barSeriesData.add(barChartSeriesModel);
    }

    public void addXAxisData(String xaxisData) {
        this.xAxisData.add(xaxisData);
    }

    public void setMin(Long min) {
        this.barChartYAxisOptionModel.setMin(min);
    }

    public void setMax(Long max) {
        this.barChartYAxisOptionModel.setMax(max);
    }

    public void setInterval(Long interval) {
        this.barChartYAxisOptionModel.setInterval(interval);
    }

    public void setUnit(String unit) {
        this.barChartYAxisOptionModel.setUnit(unit);
    }

}
